package com.kangyi.admin.mapper;

import com.github.pagehelper.Page;
import com.kangyi.admin.annotation.AutoFill;
import com.kangyi.dto.EmployeePageQueryDTO;
import com.kangyi.entity.AdminUser;
import com.kangyi.enumeration.OperationType;
import com.kangyi.vo.EmployeeDetailVO;
import com.kangyi.vo.EmployeePageQueryVO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author Blank
 * @version 1.0
 */
@Mapper
public interface EmployeeMapper {
    Page<EmployeePageQueryVO> pageQuery(EmployeePageQueryDTO employeePageQueryDTO);

    void deleteEmployee(List<Integer> ids);

    @Insert("insert into admin_user(nursing_home_id, name, age, gender, id_card, headshot, phone, password, permissions, position, status, create_time, update_time, create_user, update_user) " +
            "values (#{nursingHomeId},#{name},#{age},#{gender},#{idCard},#{headshot},#{phone},#{password},#{permissions},#{position},#{status},#{createTime},#{updateTime},#{createUser},#{updateUser})")
    @AutoFill(value = OperationType.INSERT)
    void addEmployee(AdminUser adminUser);

    @AutoFill(value = OperationType.UPDATE)
    void editEmployee(AdminUser adminUser);

    @Select("select * from admin_user where id = #{employeeId};")
    EmployeeDetailVO detailEmployee(Integer employeeId);
}
